home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / TSPA3460 / TSUNTM.INT < prev    next >
Text File  |  1994-08-16  |  4KB  |  112 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT M
  5.  
  6. A Turbo Pascal unit of keyboad routines.
  7. All rights reserved 16-Aug-94
  8.  
  9. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  10. NON-INSTITUTIONAL purposes, provided it is not changed in any way, and
  11. that a proper attribution is made. For ANY other usage, such as use in a
  12. business enterprise or at a university, contact the author for the terms
  13. of registration.
  14.  
  15. The units are under development. Comments and contacts are solicited. If
  16. you have any questions, please do not hesitate to use electronic mail for
  17. communication.
  18. InterNet address: ts@uwasa.fi
  19.  
  20. The author shall not be liable to the user for any direct, indirect or
  21. consequential loss arising from the use of, or inability to use, any unit,
  22. program or file howsoever caused. No warranty is given that the units and
  23. programs will work under all circumstances.
  24.  
  25. Timo Salmi
  26. Professor of Accounting and Business Finance
  27. Faculty of Accounting & Industrial Management; University of Vaasa
  28. P.O. BOX 297, FIN-65101 Vaasa, Finland
  29. *)
  30.  
  31. unit TSUNTM;
  32.  
  33. (* ======================================================================= *)
  34.                           interface
  35. (* ======================================================================= *)
  36.  
  37. uses Dos
  38.      {$IFDEF VER40}
  39.      ,TSUNT45
  40.      {$ENDIF}
  41.      ;
  42.  
  43. (* =======================================================================
  44.                 Key routines with no Ctr needed
  45.    ======================================================================= *)
  46.  
  47. (* As Turbo Pascal KeyPressed but does not require the Crt unit *)
  48. function KEYPREFN : boolean;
  49.  
  50. (* As Turbo Pascal ReadKey but does not require the Crt unit *)
  51. function READKEFN : char;
  52.  
  53. (* Enhanced keyboard ReadKey, no Ctr unit needed. Detects also F11 and F12,
  54.    and distinguishes between the numeric keypad and the gray keys.
  55.    Lower part of the word returns the first scan code, the higher part
  56.    the second, if applicable. *)
  57. function RDENKEFN : word;
  58.  
  59. (* This function resembles the traditional Basic inkey function.
  60.    It returns the pressed character with no echo. Special chacarters
  61.    are returned in the usual paired manner (chr(0) + code).
  62.    If timelimit seconds is exceeded timeout becomes true (and a
  63.    chr(0) is returned by inkeyfn). *)
  64. function INKEYFN (timelimit : real; var timeout : boolean) : char;
  65.  
  66. (* =======================================================================
  67.         More key routines with no Ctr needed, no key repeat
  68.    ======================================================================= *)
  69.  
  70. (* Is the left shift key depressed *)
  71. function LFSHFTFN : boolean;
  72.  
  73. (* Is the right shift key depressed *)
  74. function RTSHFTFN : boolean;
  75.  
  76. (* Is the ctrl key depressed *)
  77. function CTRLFN : boolean;
  78.  
  79. (* Is the left ctrl key depressed *)
  80. function LFCTRLFN : boolean;
  81.  
  82. (* Is the right ctrl key depressed *)
  83. function RTCTRLFN : boolean;
  84.  
  85. (* Is the alt key depressed *)
  86. function ALTFN : boolean;
  87.  
  88. (* Is the left alt key depressed *)
  89. function LFALTFN : boolean;
  90.  
  91. (* Is the right alt key depressed *)
  92. function RTALTFN : boolean;
  93.  
  94. (* Is the SysRq key depressed *)
  95. function SYSRQFN : boolean;
  96.  
  97. (* =======================================================================
  98.                   Getting keyscan codes
  99.    ======================================================================= *)
  100.  
  101. (* Every now and then a programmer need to find out the scan codes
  102.    of the keyboard keys. GETSCAN returns the scancode (and the ascii
  103.    value) of the key pressed. For an enhanced AT keyboard use
  104.    GETESCAN. *)
  105. procedure GETSCAN (var scancode, character : byte);
  106.  
  107. (* Get scancode and ascii value of a key pressed for an enhanced
  108.    keyboard. To test the presence of an enhanced keyboard use
  109.    ISENHAFN from the TSUNTH unit *)
  110. procedure GETESCAN (var scancode, character : byte);
  111.  
  112.